Data visualisations
the ausdex module comes with several data visulisations out of the box build with plotly.
Visualisations can be created via the command line and saved as html files, or created programmatically.
Inflation data visualisations
Inflation data can be visulised by a time series of the values of a given price inflated to a particular “dollar year”. Additionally, the consumer price index (CPI) time series can be plotted.
Inflation visualisations
Inflation visulisations can be created from the command line, and via the python api.
Via the command line:
an inflation chart can be created and saved as an html file via the following command:
ausdex plot-inflation [OPTIONS] COMPARE_DATE OUT
With the following arguments and options:
COMPARE_DATE(str): Date to set relative value of the dollars too.OUT(Path): Path to html file where plot will be saved. options:--start-date: (Union[datetime, str, None], optional): Date to set the beginning of the time series graph. Defaults to None, which starts in--end_date: (Union[datetime, str, None], optional): Date to set the end of the time series graph too. Defaults to None, which will set the end date to the most recent quarter.value: (Union[float, int], optional): Value you incompare_datedollars to plot on the time series. Defaults to 1.
Via the python api
The same chart can be created with the same arguments programmatically
[1]:
from ausdex.inflation import plot_inflation_timeseries
UserWarning: The Shapely GEOS version (3.8.0-CAPI-1.13.1 ) is incompatible with the GEOS version PyGEOS was compiled with (3.9.1-CAPI-1.14.2). Conversions between both will be slow.
[2]:
fig = plot_inflation_timeseries('12-12-2019', start_date='12-12-1950', end_date='12-06-2020')
Downloading https://www.abs.gov.au/statistics/economy/price-indexes-and-inflation/consumer-price-index-australia/dec-2021/640101.xls to /Users/garberj/Library/Caches/ausdex/640101-dec-2021.xls
CPI data for 2022-01-27 12:23:21.522936 not available.
[3]:
fig.show()
CPI visualisations
The time series of the CPI can be created as an html file via the command line, or programmatically via the python api.
Via the command line
Using the following commands, a time series fo the CPI can be generated.
an inflation chart can be created and saved as an html file via the following command:
ausdex plot-cpi [OPTIONS] OUT
With the following arguments and options:
OUT(Path): Path to html file where plot will be saved. options:--start-date: (Union[datetime, str, None], optional): Date to set the beginning of the time series graph. Defaults to None, which starts in--end_date: (Union[datetime, str, None], optional): Date to set the end of the time series graph too. Defaults to None, which will set the end date to the most recent quarter. #### Via the python api The same plot can be made programmatically via the python api
[4]:
from ausdex.inflation import plot_cpi_timeseries
[5]:
fig_cpi = plot_cpi_timeseries(start_date=1960, end_date='12-12-2016')
[6]:
fig_cpi.show()
Seifa_vic visualisations
Map visualisations, as well as time series of selected suburbs can be created programmatically or via the command line.
Map visualisations
Plotly choropleth maps of suburb interpolated seifa vic metrics can be created via a given year on the command line and via the python api.
On the command line:
ausdex seifa-vic-map [OPTIONS] DATE METRIC:[ier_score|irsd_score|ieo_sc
ore|irsad_score|rirsa_score|uirsa_score] OUT
with the following inputs:
DATE(int, float, str): Year values in decimal years or in a string datetime format convertable by pandas.to_datetime functionMETRIC: is the name of the metric to interpolate:irsd_scorefor index of relative socio economic disadvantage,ieo_scorefor the index of education and opportunity,ier_scorefor an index of economic resourcesirsad_scorefor index of socio economic advantage and disadvantage,uirsa_scorefor the urban index of relative socio economic advantage,rirsa_scorefor the rural index of relative socio economic advantage
OUT(Path): Path to save html graph to.
options: - --fill-value (str, optional): optional input that dictates how the data are extrapolated outside the year range of the dataset. default is null which returns np.nan values. Other options include extrapolate, which extrapolates the data, boundary_value which takes the nearest data point, and options defined in the scipy.interpolate.interp1d fill_value optional argument. -
--min-x (float, optional): minimum x coordinate boundary of intersecting polygons to plot. Defaults to None. - --min-y (float, optional): maximum x coordinate boundary of intersecting polygons to plot. Defaults to None. - --max-x (float, optional): minimum y coordinate boundary of intersecting polygons to plot Defaults to None. - --max-y (float, optional): maximum y coordinate boundary of intersecting polygons to plot. Defaults to None. - --clip-mask (Path, optional): path to
mask polygon data to clip the dataset to, overrides min_x, max_x, min_y, max_y. Defaults to None.
Via the python api
The same graph can be created via the python api with an additoinal argument:
simplify (float, optional): This argument simplifies the geometries using the simplify value as the tolerance input in geopandas.GeoSeries.simplify. Defaults to 0.001
[7]:
from ausdex.seifa_vic import get_seifa_map
[8]:
fig_map = get_seifa_map('12-12-2015', 'ier_score', fill_value='extrapolate', max_y = -37.45, simplify= 0.01)
/Users/garberj/opt/anaconda3/envs/aucpi_env/lib/python3.7/site-packages/geopandas/geodataframe.py:1351: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
[9]:
fig_map.show()
Plotting SEIFA time series:
In addition to maps of individual times, a time series can be plotted for selected suburbs via the command line, and programmatically via the python api.
Via the command line
SIEFA metric time series can be plotted using the following command:
ausdex seifa-vic-plot [OPTIONS] METRIC:[ier_score|irsd_score|ieo_score|
irsad_score|rirsa_score|uirsa_score] OUT
SUBURBS...
with the following inputs and options:
METRIC(Union[Metric, str]): metric to plot along the time series.irsd_scorefor index of relative socio economic disadvantage,ieo_scorefor the index of education and opportunity,ier_scorefor an index of economic resourcesirsad_scorefor index of socio economic advantage and disadvantage,uirsa_scorefor the urban index of relative socio economic advantage,rirsa_scorefor the rural index of relative socio economic advantage
OUT(Path): Path to html file where plot will be savedSUBURBS(list): list of suburbs to include in the time series
Via the python api
The same plot can be created programmatically via the python api
[10]:
from ausdex.seifa_vic import create_timeseries_chart
[11]:
fig_seifa_time = create_timeseries_chart(['abbotsford', 'footscray'], 'ier_score')
[12]:
fig_seifa_time.show()
[ ]:
[ ]: